$def with (strategy_item,comments)
<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <title>策略详情</title>
  <link rel="stylesheet" href="./css/common.css">
  <link rel="stylesheet" href="./css/tactics_detail.css">
</head>
<body>
<header class="header">
  <div class="column">
    <img class="logo" src="http://our8pafcg.bkt.clouddn.com/zhike/images/logo.png" alt="智客">
  </div>
  <div class="column column-right">
    <a href="/" class="active-tab">首页</a>
    <a href="/study">开始研究</a>
    <a href="/personal_center" >个人中心</a>
    <a href="/help">帮助</a>
    <a href='/login'>
      <button class="btn btn-primary btn-radius btn-login">登录</button>
    </a>
    <a id="register_id" href="/register">注册</a>
  </div>
</header>
<div class="container">
  <div class="info-wrapper">
    <div class="info-left">
      <div class="info">
        <p>$strategy_item["strategy_name"]</p><span hidden id="strategy_id">$strategy_item["_id"]</span>
        <p class="message">策略思路：策略思路</p>
      </div>
      <div class="profit">
        <div class="profit-item">
          <span class="item-title">总收益率</span><br>
          <span class="all-profit">$strategy_item["total_gain_rate"]%</span>
        </div>
        <div class="profit-item total_gain_cls">
          <span class="item-title">收益</span><br>
          <span id="total_gain_id">$strategy_item["total_gain"]</span>

        </div>
        <div class="profit-item init_capital_cls">
          <span class="item-title">初始资金</span><br>
          <span id="init_capital_id">$strategy_item["init_capital"]</span>

        </div>
        <div class="profit-item rate_cls">
          <span class="item-title">胜率</span><br>
          <span id="rate_id">$strategy_item["winning_rate"]%</span>
        </div>
      </div>
    </div>
    <div class="info-right">
      <p class="tactics-author">发布者：$strategy_item["username"]</p>
      <p>交易次数：$strategy_item["transaction_count"]</p>
      <p>订&ensp;阅&ensp;数：$strategy_item["subscribe_count"]</p>
      <p>订&ensp;阅&ensp;费：$strategy_item["price"]元/月</p>
      <p hidden class="strategy_id_cls"> $strategy_item['_id']</p>
      <button class="btn btn-scribe btn-subscribe">立即订阅</button>
      <span class="tips_cls" style="color:red;font-size:10px"></span>　
    </div>
  </div>
  <h4>收益走势</h4>
  <!-- 统计图表 -->
  <div class="chart-wrapper">
    <div id="chart" class="chart"></div>
  </div>

  <h4>评论</h4>
  <div class="comment-wrapper">
    $for comment in comments:
      <div class="comment-item">
        <p>$comment["user_id"]</p>
        <p class="comment-time">$comment["comment_time"]</p>
        <p class="comment-content">
          $comment["comment_text"]
        </p>
      </div>

    <div class="publish-wrapper">
      <input id="text_box" type="text" placeholder="发表评论">
      <button id="save_comment" class="btn btn-primary btn-radius btn-comment">评论</button>
      <span class="tips_comment_cls" style="color:red;font-size:10px"></span>
    </div>
  </div>
</div>
<footer class="footer">
  <div class="inner-wrap">
    <div>
      <p class="col-title"><i class="iconfont icon-link"></i>&nbsp;相关链接</p>
      <div class="content">
        <a href="http://www.datayes.com/" target="_blank">通联数据</a>&nbsp;&nbsp;让投资更容易
        <br/>
        <a href="http://m.datayes.com/" target="_blank">数据商城</a>&nbsp;&nbsp;海量金融大数据
        <br/>
        <a href="https://mof.datayes.com/" target="_blank">通联魔方</a>&nbsp;&nbsp;MOM/FOF全流程管理平台
        <br/>
        <a href="https://robo.tt/home/" target="_blank">萝卜投研</a>&nbsp;&nbsp;智能投研平台
        <br/>
        <a href="http://www.jinlingxuetang.com" target="_blank">金领学堂</a>&nbsp;&nbsp;学习更便捷
      </div>
    </div>
    <div>
      <p class="col-title"><i class="iconfont icon-location"></i>&nbsp;联系地址</p>
      <div class="content">
        总部地址： 北京市朝阳区望京街道保利国际广场T2-303
        <br/>成都分部： 四川省成都市天府大道中段希顿广场C座701
      </div>
    </div>
    <div>
      <p class="col-title"><i class="iconfont icon-telephone"></i>&nbsp;联系方式</p>
      <div class="content">
        电话: 400-696-8026
      </div>
    </div>
    <div class="qrcode-wrapper">
      <img class="qrcodeimg" src="https://uqer.io/home/img/code.jpg" alt="二维码"><br>
      <span>扫描二维码关注公众号</span>
    </div>
  </div>
  <br>
  <p class="copyright">
    <span>© 2017 <a href="http://www.datayes.com/" target="_blank">DataYes</a></span>
    <a class="icp" href="http://www.miibeian.gov.cn/" target="_blank">沪ICP备13045831号</a>
    <span>咨询热线：4000 820 386</span>
    <span>智客 Beta</span>
    <a href="http://www.datayes.com/protocol" target="_blank">用户协议</a>
  </p>
</footer>

<script src="http://our8pafcg.bkt.clouddn.com/zhike/./js/echarts.min.js?v=1"></script>
<script src="/js/jquery.js"></script>
<!--For islogin-->
<script src="/js/validation_islogin_detail.js"></script>

<script>

   jQuery(document).ready(function(){
        var total_gain = jQuery("#total_gain_id").text();
        total_gain = parseFloat(total_gain);
        //alert(total_gain);
        var init_capital = jQuery("#init_capital_id").text();
        init_capital = parseFloat(init_capital);
        //alert(init_capital);
        //var rate = 0;
        //rate = 100*(total_gain/init_capital).toFixed(5);
        //alert(rate);
        //jQuery("#rate_id").text(rate+"%");


        jQuery(".btn-subscribe").mouseenter(function(event) {
            //event.preventDefault();
            //alert("MOUSEENTER event");
            jQuery.ajax({
                scriptCharset: 'utf-8',
                type: "POST",
                url: "/current_user",
                contentType:"application/json",
                data: JSON.stringify({
                    "phonenumber": document.cookie.split(';')[1].split('=')[1],
                    "uid": document.cookie.split(';')[0].split('=')[1]
                }),
                dataType: "json",
                success: function(success) {
                    var g_username = success.username;
                    //var username=jQuery(element).children(".strategy_username_cls").text();
                    if (g_username ==null || g_username == undefined || g_username == ""){
                        //alert("g_username:" + g_username);
                        //alert("提示尚未登录");
                        jQuery(".tips_cls").text("请先登录再订阅");
                    }
                },
                error: function(error) {
                    alert("EORROR current user.");
                }
            });
        });

        jQuery(".btn-comment").mouseenter(function(event) {
            //alert("MOUSEENTER event");
            jQuery.ajax({
                scriptCharset: 'utf-8',
                type: "POST",
                url: "/current_user",
                contentType:"application/json",
                data: JSON.stringify({
                    "phonenumber": document.cookie.split(';')[1].split('=')[1],
                    "uid": document.cookie.split(';')[0].split('=')[1]
                }),
                dataType: "json",
                success: function(success) {
                    var g_username = success.username;
                    if (g_username ==null || g_username == undefined || g_username == ""){
                        //alert("提示尚未登录");
                        jQuery(".tips_comment_cls").text("请登录后评论");
                    }
                },
                error: function(error) {
                    alert("EORROR current user.");
                }
            });
        });


        jQuery("#save_comment").on("click", function(event) {
            event.preventDefault();
            jQuery.ajax({
                scriptCharset: 'utf-8',
                type: "POST",
                url: "/save_comment",
                contentType:"application/json",
                data: JSON.stringify({
                    "phonenumber": document.cookie.split(';')[1].split('=')[1],
                    "comment_text": jQuery("#text_box").val(),
                    "strategy_id": jQuery("#strategy_id").text()
                }),
                dataType: "json",
                success: function(success) {
                    //alert("Comment is saved.");
                    window.location.reload(true);
                },
                error: function(error) {
                }
            });
        });

        // to subscribe a strategy in the page 'tatics_detail'
        jQuery(".btn-subscribe").on("click", function(event){
            //alert(event.target);
            var x = jQuery(event.target).siblings(".strategy_id_cls").text();
            //alert("id" + x);
             event.preventDefault();
            jQuery.ajax({
                scriptCharset: 'utf-8',
                type: "POST",
                url: "/subscribe",
                contentType:"application/json",
                data: JSON.stringify({
                    "phonenumber": document.cookie.split(';')[1].split('=')[1],
                    "strategy_id": jQuery(event.target).siblings(".strategy_id_cls").text()
                }),
                dataType: "json",
                success: function(success) {
                    //alert("Subscribed.");
                    window.location.reload(true);
                },
                error: function(error) {
                }
            });

        });
   });

   jQuery(document).ready(function(){
        jQuery.ajax({
            scriptCharset: 'utf-8',
            type: "POST",
            url: "/tactics_detail",
            contentType:"application/json",
            data: JSON.stringify({"id": jQuery("#strategy_id").text()}),
            dataType: "json",
            success: function(result) {
                //alert("Success--detail");
                var date = result["listdate"];
                var data = result["listdata"];

                // 使用 DOM节点 初始化echarts实例
                var chart = echarts.init(document.getElementById('chart'));
                //var chart = echarts.init(jQuery('#chart'));

                var baseOption = {
                    tooltip: {
                      trigger: 'axis',
                      backgroundColor: '#328bf4'
                    }, // 提示框组件
                    xAxis: {
                      type: 'category', // 类目轴
                      boundaryGap: false, // 两边不留白
                      data: []
                    },
                    yAxis: { // Y 轴
                      type: 'value',
                    },
                    grid: { // 控制坐标轴位置
                      top: 10,
                      left: 60,
                      right: 65,
                    },
                    dataZoom: [{
                      startValue: 0, /* 显示数组值中的 0~10 (index) */
                      endValue: 9
                    }], // 区域缩放组件,图表下方显示区域缩放滚动条
                    series: [{
                      type: 'line', // 折线图
                      smooth: false, // 直线
                      sampling: 'average', // 优化图表的绘制效率,取过滤点的平均值
                      areaStyle: { // 区域填充样式
                        normal: {
                          color: 'rgba(73, 152, 244, 0.1)'
                        }
                      },
                      data: [],
                      color: ['#328bf4'] // 折线颜色
                    }]
                  }; // 基础配置

                // 基础配置
                chart.setOption(baseOption);

                //导入数据
                chart.setOption({
                    xAxis:{data: date},
                    series: [{data: data}]
                });
            },
            error: function(error) {
                //alert("Ajax detail Error.");
            }
        });
   });

</script>
</body>
</html>
